package com.zhaorui.form;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import org.simpleframework.xml.Path;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * @NotEmpty 用在集合类上面
 * @NotBlank 用在String上面
 * @NotNull 用在基本类型上
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserAddForm {
    @NotBlank(message = "账号不能为空")
    @Length(max = 20, message = "账号过长!")
    private String userName;
    @NotBlank(message = "密码不能为空")
    @Length(max = 20, message = "密码过长!")
    private String userPass;
    @NotBlank(message = "图片不能为空")
    private String userPic;
    @NotBlank(message = "姓名不能为空")
    @Length(max = 20, message = "姓名过长!")
    private String picName;
    @NotNull(message = "身份证号不能为空")
//    @Pattern (regexp = "^[0-9]\\\\d{18}",message = "请输入18位数字!")//长度18,0-9
    @Length(min = 18,max = 18)
    @Pattern (regexp="^\\d+$")
    private String userId;
    @NotBlank(message = "电话号码不能为空")
//    @Pattern (regexp = "^[0-9]\\\\d{11}",message = "请输入11位有效电话号码!")//长度11,0-9
    @Length(min = 11,max = 11)
    @Pattern (regexp="^\\d+$")
    private String userPhone;
    @NotNull(message = "会员等级不能为空")
    private Integer userLevel;
}
